home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc1_2_x / stckdmpr.sit / Stack Dumper 2.0 / background_2744.txt < prev    next >
Text File  |  1989-10-24  |  7KB  |  245 lines

  1. -- background: 2744 from stack: in.0
  2. -- bmap block id: 3186
  3. -- flags: 4000
  4. -- background id: 0
  5. -- name: Stack Dumper
  6.  
  7.  
  8. -- part 7 (field)
  9. -- low flags: 01
  10. -- high flags: 2004
  11. -- rect: left=5 top=7 right=94 bottom=329
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 3
  16. -- text size: 24
  17. -- style flags: 256
  18. -- line height: 30
  19. -- part name: 
  20.  
  21.  
  22. -- part 8 (field)
  23. -- low flags: 01
  24. -- high flags: 0007
  25. -- rect: left=5 top=101 right=337 bottom=508
  26. -- title width / last selected line: 0
  27. -- icon id / first selected line: 0 / 0
  28. -- text alignment: 0
  29. -- font id: 3
  30. -- text size: 12
  31. -- style flags: 0
  32. -- line height: 16
  33. -- part name: 
  34.  
  35.  
  36. -- part 3 (button)
  37. -- low flags: 00
  38. -- high flags: 2000
  39. -- rect: left=474 top=0 right=25 bottom=512
  40. -- title width / last selected line: 0
  41. -- icon id / first selected line: 20098 / 20098
  42. -- text alignment: 1
  43. -- font id: 0
  44. -- text size: 12
  45. -- style flags: 0
  46. -- line height: 16
  47. -- part name: Home
  48. ----- HyperTalk script -----
  49. on mouseUp
  50.   go home
  51. end mouseUp
  52.  
  53.  
  54.  
  55. -- part 9 (button)
  56. -- low flags: 00
  57. -- high flags: 8003
  58. -- rect: left=339 top=65 right=96 bottom=506
  59. -- title width / last selected line: 0
  60. -- icon id / first selected line: 0 / 0
  61. -- text alignment: 1
  62. -- font id: 0
  63. -- text size: 12
  64. -- style flags: 0
  65. -- line height: 16
  66. -- part name: Dump scripts
  67. ----- HyperTalk script -----
  68. on mouseUp
  69.   global SDFileout, msgloc
  70.   push card
  71.   pop card into SDCard -- don't leave it in the stack in case
  72.   -- the target stack clobbers it
  73.   lock screen
  74.   get the loc of msg
  75.   put it into msgloc
  76.   set the loc of msg to 22, -30
  77.   go to "the stack to dump"
  78.   -- this will put of the Standard File dialog with
  79.   -- "where is "the stack to dump"
  80.   -- BUG: the stack is dumped even if the user selects "cancel"
  81.   put "Dumped Scripts Data" into defaultName
  82.   put StandardFile("put", defaultName) into SDFileout
  83.   if SDFileout is empty then
  84.     go to SDCard
  85.     QuitDump
  86.     exit mouseUp
  87.   end if
  88.   open file SDFileout
  89.   get ChangeFileType(SDFileout, "TEXT", "MSWD")
  90.   set cursor to busy
  91.   -- dump the stack properties and script
  92.   writestr "Item"&tab&"Name"&tab&"Props"&tab&"Script"&return
  93.   get "Stack" & tab & short name of this stack & tab
  94.   put "Dumping scripts of"&&it into msg
  95.   writestr it
  96.   writestr StackProperties() & tab
  97.   dumpScripts this, Stack
  98.   -- now dump each background
  99.   put number of backgrounds into Nbg
  100.   repeat with i = 1 to Nbg
  101.     go first cd of bg i
  102.     get "Background " & i & tab & short name of this bg & tab
  103.     put it into msg
  104.     writestr it
  105.     writestr BgProperties() & tab
  106.     dumpScripts this, Background
  107.     -- now dump each bg button and each bg field
  108.     dumpScripts Background, button
  109.     dumpScripts Background, field
  110.     -- dump each card within this background
  111.     put number of cards of this bg into Ncd
  112.     repeat with j = 1 to Ncd
  113.       go to card j of this bg
  114.       put CdProperties() into CdProps
  115.       if CDProps & the script of this card is empty then next repeat
  116.       get "Card "&j&" of background "&i&": "&short name of this bg& " (card "&number of this card&")"& tab & short name of this cd & tab & CdProps & tab
  117.       put it into msg
  118.       writestr it
  119.       dumpScripts this, Card
  120.       dumpScripts Card, button
  121.       dumpScripts Card, field
  122.     end repeat
  123.   end repeat
  124.   close file SDFileout
  125.   go to SDCard
  126.   QuitDump
  127. end mouseUp
  128.  
  129. on dumpScripts place, object
  130.   if place is "this" then
  131.     do "get the script of this "&object
  132.     if it is empty then writestr "<No "&object&" script>"
  133.     else WriteScript(it)
  134.     writestr return
  135.   else
  136.     do "put the number of "&place&&object&"s into Nob"
  137.     if Nob > 0 then
  138.       put place&&object&&Nob into msg
  139.       repeat with i = 1 to Nob
  140.         do "get the script of "&place&&object&&i
  141.         if it is empty then next repeat
  142.         do "put the short name of "&place&&object&&i&" into theName"
  143.         writestr place&&object&&i&tab&theName&tab
  144.         writestr Visible(place, object, i) & tab
  145.         WriteScript(it)
  146.         writestr return
  147.       end repeat
  148.     end if
  149.   end if
  150. end dumpScripts
  151.  
  152. Function StackProperties
  153. return plural(number of cards, "card") & "; " & plural(number of backgrounds, "background") & "."
  154. end StackProperties
  155.  
  156. Function BgProperties
  157. return plural(number of cards of this bg, "card") & "; " & plural(number of bg buttons, "background button") & "; " & plural(number of bg fields, "background field") & "."
  158. end BgProperties
  159.  
  160. Function CdProperties
  161. put number of cd fields into NFlds
  162. put number of cd buttons into NBtns
  163. if Nflds = 0 and NBtns = 0 then return empty
  164. return plural(NBtns, "card button") & "; " & plural(NFlds, "card field") & "."
  165. end CdProperties
  166.  
  167. Function Visible place, object, n
  168. do "get the visible of "&place&&object&&n
  169. if it is true then return "Visible."
  170. else return "Hidden."
  171. end Visible
  172.  
  173.  
  174.  
  175.  
  176. -- part 10 (button)
  177. -- low flags: 00
  178. -- high flags: 8003
  179. -- rect: left=340 top=31 right=62 bottom=504
  180. -- title width / last selected line: 0
  181. -- icon id / first selected line: 0 / 0
  182. -- text alignment: 1
  183. -- font id: 0
  184. -- text size: 12
  185. -- style flags: 0
  186. -- line height: 16
  187. -- part name: Dump fields
  188. ----- HyperTalk script -----
  189. on mouseUp
  190.   global SDFileout, msgloc
  191.   push card
  192.   pop card into SDCard -- don't leave it in the stack in case
  193.   -- the target stack clobbers it
  194.   get the loc of msg
  195.   put it into msgloc
  196.   set the loc of msg to 22, -30
  197.   go to "the stack to dump"
  198.   put number of backgrounds into n
  199.   repeat with i = 1 to n
  200.     put 0 into SDNfields
  201.     go first cd of bg i
  202.     put the number of bg fields into NFields
  203.     put the short name of this background into BgName
  204.     put "Background "&i&": "&BgName&& (number of cards of this bg) && "cards," && Nfields && "bg fields" into msg
  205.     beep
  206.     if Nfields = 0 then
  207.       answer "This background has no bg fields." with "ok"
  208.       next repeat
  209.     end if
  210.     answer "Dump cards of this background?" with "yes" or "no" or "cancel"
  211.     if it is "no" then next repeat
  212.     if it is "cancel" then exit repeat
  213.     put StandardFile("put", BgName & ".text") into SDFileout
  214.     if SDFileout is empty then exit repeat
  215.     open file SDFileout
  216.     get ChangeFileType(SDFileout, "TEXT", "MSWD")
  217.     repeat with j = 1 to Nfields
  218.       writestr "Field" & j
  219.       if j = NFields then writestr return
  220.       else writestr tab
  221.     end repeat
  222.     lock screen
  223.     repeat with c = 1 to (number of cards of this bg)
  224.       set cursor to busy
  225.       go to card c of this bg
  226.       dumpBgFields Nfields
  227.     end repeat
  228.     unlock screen
  229.     close file SDFileout
  230.   end repeat
  231.   go to SDCard
  232.   QuitDump
  233. end mouseUp
  234.  
  235. on dumpBgFields Nfields
  236.   repeat with i = 1 to Nfields
  237.     WriteText(bg field i)
  238.     if i Γëá Nfields then writestr tab
  239.     else writestr return
  240.   end repeat
  241.   put the number of this card into msg
  242. end dumpBgFields
  243.  
  244.  
  245.